<%--
  Created by IntelliJ IDEA.
  User: CY
  Date: 2017/12/25
  Time: 10:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>报送查询</title>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ? MYOA_CHARSET : htmlspecialchars($HTML_PAGE_CHARSET))?>" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" type="text/css" href="../../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="../css/news/management_query.css" />
    <%--<link rel="stylesheet" type="text/css" href="/css/patrol/patrol.css"/>--%>
    <script src="../js/jquery/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../lib/layer/layer.js?20201106"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <style>
        .header{
            width:100%;
            height:45px;
            border-bottom:1px solid #9E9E9E;
            position:fixed;
            top:0px;
            z-index: 100;
            background: #fff;
        }
        .nav{
            overflow:hidden;
        }
        .nav li{
            height:28px;
            line-height:28px;
            float:left;
            font-size:14px;
            margin-left:20px;
            margin-top:6px;
            cursor:pointer;
        }
        .space{
            width:2px;
            margin-left:16px;
        }
        .pad{
            padding:3px 10px;
            line-height:28px;
        }
        .select{
            background-color:#2F8AE3;
            color:#fff;
            border-radius:20px;
            -webkit-border-radius:20px;
            -moz-border-radius:20px;
            -o-border-radius:20px;;
            -ms-border-radius:20px;
        }
        select{
            border-radius: 3px;
            height:28px;
            margin-left:20px;
        }
        #query{
            background: #00a0e9;
            margin-left: 10px;
            padding: 3px 10px;
            border-radius: 4px;
            color: #fff;
            cursor: pointer;
        }
        .add{
            float: right;
            display: inline-block;
            background-color: #2f80d1;
            margin-top: -27px;
            margin-right: 30px;
            font-size: 14px;
            cursor: pointer;
            border: #ccc 1px solid;
            color: #fff;
            border-radius: 5px;
            text-align: center;
            line-height: 28px;
            height: 28px;
            width: 70px;
        }
        .edui-default .edui-editor{
            width:100%!important;
        }
        .title_{
            height:28px;
            border-radius: 3px;
            float:none;
            width:160px!important;
            border:1px solid #ccc;
        }
        textarea{
            border-radius: 3px;
        }
        #back{
            background: #00a0e9;
            margin-left: 10px;
            padding: 3px 10px;
            border-radius: 4px;
            color: #fff;
            cursor: pointer;
            margin-top:20px;
        }
        .clearfix tr:hover{
            background: none;
        }
        .M-box3 .active{
            margin: 0px 3px;
            width: 29px;
            height: 29px;
            line-height: 29px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color:#fff;
            text-align:center;
            display: inline-block;
        }
        .M-box3 a{
            margin: 0 3px;
            width: 29px;
            height: 29px;
            line-height: 29px;
            font-size: 12px;
            display: inline-block;
            text-align:center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #bdbdbd;
            text-decoration: none;
        }
        .jump-btn{
            background: #2b7fe0;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="header">
        <ul class="nav">
            <li url="/vote/manage/voteList">
                <span class="select pad">报送查询</span>
                <img class="space" src="../../img/twoth.png" alt="">
            </li>
        </ul>
        <%--<span class="add choose" data-type="0" type="0" id="add">新建</span>--%>
    </div>
    <div class="content" >
        <div class="queryCon" style="padding-top:60px;">
            <form id="queryNews">
                <table class="clearfix total" style="min-width:600px;">
                    <tbody>
                    <tr>
                        <td colspan="2" class="query_title">
                            输入查询条件
                        </td>
                    </tr>
                    <tr >
                        <td class="size_color">
                            报送标题:
                        </td>
                        <td style="text-align: left">
                            <input class="title_" name="title" id="title" type="text" style="width:300px!important;"/>
                        </td>
                    </tr>
                    <tr>
                        <td class="size_color">
                            是否采集:
                        </td>
                        <td style="text-align: left">
                            <input class="" name="iscollection" type="radio" style="width:15px;float:none" value="1" />
                            <label for="">是</label>
                            <input class="" name="iscollection"  type="radio"  style="width:15px;float:none" value="0" checked/>
                            <label for="">否</label>
                        </td>
                    </tr>
                    <tr>
                        <td class="size_color">
                            报送时间:
                        </td>
                        <td style="text-align: left">
                            <input class="title_" name="startTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" type="text" />
                            <span>~</span>
                            <input class="title_" name="endTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" type="text" />
                        </td>
                    </tr>
                    <tr>
                        <td class="size_color">
                            填报科室:
                        </td>
                        <td style="text-align: left">
                            <textarea name="deliveryDeptId" id="deliveryDeptId" class="deliveryDeptId" deptid=""  style="width:300px;height:50px;"></textarea>
                            <a href="javascipt:;" class="addDept">选择</a>
                            <a href="javascipt:;" class="emptyDept" onclick="emptyDept()">清空</a>
                        </td>
                    </tr>
                    <tr>
                        <td class="size_color">
                            报送人员:
                        </td>
                        <td style="text-align: left">
                            <textarea name="userId" id="userId"  style="width:300px;height:50px;" user_id=""></textarea>
                            <a href="javascipt:;" class="addUserId">选择</a>
                            <a href="javascipt:;" class="emptyUser" onclick="emptyUser()">清空</a>
                        </td>
                    </tr>
                    <tr class="table_b">
                        <td colspan="2">
                            <div class="bt determine cha" style="color:#333;">查询</div>
                            <div class="exportNew" id="ept">重置</div>
                            <div id="export">导出</div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
        <div class="conList" style="padding-top:90px;display: none" id="conList">
            <div style="margin: -45px auto 0px;height:50px;width: 97%;" class="clearfix">
                <div id="dbgz_page" class="M-box3">

                </div>
            </div>
            <div class="table">
                <table style="width:98%;margin:0 auto">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>填报部门</th>
                        <th>报送人</th>
                        <th>报送时间</th>
                        <th>标题</th>
                        <th>是否采集</th>
                        <th>是否阅读</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody class="list">
             <%--       <tr>
                        <td>编号</td>
                        <td>报送部门</td>
                        <td>报送人</td>
                        <td>报送时间</td>
                        <td>标题</td>
                        <td>是否采集</td>
                        <td>是否阅读</td>
                        <td>
                            <a href="javascript:;" class="choose" data-type="1" type="0">修改</a>
                            <a href="javascript:;" class="detail" data-type="2" type="0">查看详情</a>
                        </td>
                    </tr>--%>
                    </tbody>
                </table>
                <div style="width: 100%;text-align: center">
                    <button id="back">返回</button>
                </div>
            </div>
        </div>
        <div style="width:100%;height:100%;display: none;" class="iframe" id="info" style="display: none">
            <div style="padding-top:50px;">
                <iframe vote_id="0" id="iframe" src="" frameborder="0" style="width:100%;height:calc(100% - 50px);padding-top:0px;"></iframe>
            </div>
        </div>
    </div>

</div>
<script>

    //格式化时间
    function   formatDate(now)   {
        if(now!=''&& now!=undefined){
            var   year=now.getFullYear();
            var   month=now.getMonth()+1;
            var   date=now.getDate();
            var   hour=now.getHours();
            var   minute=now.getMinutes();
            var   second=now.getSeconds();
            return  year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
        }else{
            return "";
        }
    }

//    点击详情
    $('.list').on('click','.detail',function(){
        var me=$(this);
        var id=me.parents('tr').attr('id')
        $('.iframe').show();
        $('#conList').hide();
        $('.queryCon').hide();
        $('#iframe').attr('src','/infomation/infoDetail?dataType='+me.attr('data-type')+'&type='+me.attr('type')+'&id='+id);
    })


    //    分页列表
    var ajaxPage={
        data:{
            page:1,//当前处于第几页
            pageSize:10,//一页显示几条
            useFlag:true
        },
        page:function () {
            var me=this;
            this.data.title=$('#title').val();
            this.data.iscollection=$('input[name="iscollection"]:checked').val();
            this.data.startTime=$('input[name="startTime"]').val();
            this.data.endTime=$('input[name="endTime"]').val();
            this.data.deptIds=$('#deliveryDeptId').attr("deptid");
            this.data.userIds=$('#userId').attr("user_id");
            this.data.export="1";
            $.ajax({
                url:'/infomation/queryInfoList',
                type:'get',
                data:me.data,
                dataType:'json',
                success:function(reg){
                    var data=reg.obj;
                    var str="";
                    if(data.length<=0){
                        $.layerMsg({content:'暂无信息',icon:6})
                    }else{
                        for(var i=0;i<data.length;i++){
                            str+='<tr id="'+data[i].id+'">' +
                                '                        <td>'+(i+1)+'</td>' +
                                '                        <td>'+data[i].deptName+'</td>' +
                                '                        <td>'+data[i].userName+'</td>' +
                                '                        <td>'+function(){
                                    if(data[i].createTime!=undefined){
                                        var c= new Date(data[i].createTime);
                                        return formatDate(c);
                                    }else{
                                        return "";
                                    }
                                }()+'</td>' +
                                '                        <td>'+data[i].title+'</td>' +
                                '                        <td>'+function(){
                                    if(data[i].iscollection==0){
                                        return '否'
                                    }else{
                                        return '是'
                                    }
                                }()+'</td>' +
                                '                        <td>'+function(){
                                    if(data[i].isread==0){
                                        return '否'
                                    }else{
                                        return '是'
                                    }
                                }()+'</td>' +
                                '<td>'+
                                /*    '                            <a href="javascript:;" class="choose" data-type="1" type="0">修改</a>' +*/
                                '                            <a href="javascript:;" class="detail" data-type="2" type="0">查看详情</a>' +
                                '                        </td>' +
                                '                    </tr>'
                        }

                    }

                    me.pageTwo(reg.totleNum,me.data.pageSize,me.data.page)
                    $('.list').html(str);
                }
            })

        },
        pageTwo:function (totalData, pageSize,indexs) {
            var mes=this;
            $('#dbgz_page').pagination({
                totalData: totalData,
                showData: pageSize,
                jump: true,
                coping: true,
                homePage:'',
                endPage: '',
                current:indexs||1,
                callback: function (index) {
                    mes.data.page=index.getCurrent();
                    mes.page();
                }
            });
        }
    }
    var dept_id="";
    var user_id="";
    //选择人员控件

    $(".addUserId").on("click",function(){//使用人
        user_id = "userId";
        $.popWindow("../../common/selectUser");
    });
    //清空人员控件
    function emptyUser(){
        $("#userId").val("");
        $("#userId").attr("dataid","");
        $("#userId").attr("user_id","");
    }


    /* 选部门控件 */
    $(".addDept").on("click",function(){//选择部门
        dept_id = "deliveryDeptId";
        $.popWindow("../../common/selectDept");
    });
    //清空部门控件
    function emptyDept(){
        $("#deliveryDeptId").val("");
        $("#deliveryDeptId").attr("deptid","");
    }



    <%--点击切换--%>
    $(document).on('click','.cha',function(){
        ajaxPage.data.page=1;
        ajaxPage.page()
        $('#conList').show();
        $('.queryCon').hide();
    })
//  点击返回
    $('#back').click(function(){
        $('#conList').hide();
        $('.iframe').hide();
        $('.queryCon').show();
    })

    //点击清空
    $('#ept').click(function(){
        $('#title').val("");
        $('input[name="iscollection"]').eq(0).prop('checked',false);
        $('input[name="iscollection"]').eq(1).prop('checked',true);
        $('input[name="startTime"]').val("");
        $('input[name="endTime"]').val("");
        emptyUser();
        emptyDept();
    })
    //点击导出
    $('#export').click(function(){

        window.location.href='<%=basePath%>infomation/queryInfoList?export=2&title='+$('#title').val()+'&iscollection='+$('input[name="iscollection"]:checked').val()+'&startTime='+$('input[name="startTime"]').val()+'&endTime='+$('input[name="endTime"]').val()+'&deptIds='+$('#deliveryDeptId').attr("deptid")+'&userIds='+$('#userId').attr("user_id");
    })

    <%--点击切换--%>
    /*$(document).on('click','.choose',function(){
        var me=$(this);
        $('#info').show();
        $('.conList').hide();
        $('.queryCon').hide();
        $('#iframe').attr('src','/infomation/infoDetail?dataType='+me.attr('data-type')+'&type='+me.attr('type'))
    })*/
  /*  //    点击查看详情
    $('.list').on('click','.detail',function(){
        var me=$(this);
        $('.iframe').show();
        $('.conList').hide();
        $('.queryCon').hide();
        $('#iframe').attr('src','/infomation/infoDetail?dataType='+me.attr('data-type')+'&type='+me.attr('type'));
    })*/



</script>
</body>
</html>
